var common = {
    server:"http://localhost:8769/",
    run:"dev",
    openFrame : function(openPage, height, id) {

        appcan.frame.open(id, openPage, 0, height);
        window.onorientationchange = window.onresize = function() {
            appcan.frame.resize(id, 0, titHeight);
        }
    },
    openPage : function(name) {
        appcan.window.open({
            name : name,
            data : name + ".html",
           
        });
    },
    runScript : function(name, run) {

        appcan.window.evaluateScript({
            name : name,
            scriptContent : run
        });
    },
    saveCache : function(key, value) {
        appcan.locStorage.setVal(key, value);
    },
    getCache : function(key) {
        return appcan.locStorage.getVal(key);
    },
    removeCache : function(key) {
        return appcan.locStorage.remove(key);
    },
    ajax : function(url,type,data,run,errorRun,dataType) {
        console.log(url)
        console.log(data)
        if(type == null ){
            type = "GET";
        }
        if(dataType==null){
            dataType="json"
        }
     appcan.ajax({
            dataType:dataType,
            url : url,
            type : type,
            data : data,
            success : function(data) {
                console.log("ok")
                
                run(data);
            },
            error : function(e) {
                console.log(e)
                console.log(errorRun)
                errorRun(e);
            }
        });
       
    }
}

function closeWin() {
    appcan.window.close(-1);
}